#include "data_deal.h"
#include "logic.h"
#include "stdlib.h"
#include "modbus.h"
#include <string>
using namespace std;
bool dealFlag = false;
extern "C" void Uart1_Data_Deal()
{
    u1Buff[u1Len] = '\0';
    string ss = (char*)u1Buff;
    u1Len = 0;
    int firstPosition = ss.find("GETPRESS:");
    int secondPosition = ss.find("#");
    if(firstPosition != -1 && secondPosition != -1)
    {
          
        dealFlag = true;
        ss = ss.substr(firstPosition+9,secondPosition-firstPosition-9);
        if(ss.length() > 5) printf("wrong addr\r\n");
        else
        {
            uint8_t tmpAddr = atoi(ss.c_str());
            if(tmpAddr == gSrcAddr || tmpAddr == 0)
            {
                gSendFlag = 1;
            }
        }
    }
    dealFlag = false;
}
